package com.heima.admin.controller.v1;

import com.heima.admin.service.ChannelLabelService;
import com.heima.model.admin.dtos.ChannelDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmChannel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/api/v1/channel")//admin/api/v1/channel/del/1
public class ChannelController {
    @Autowired
    private ChannelLabelService channelService;
    @PostMapping("/save")
    public ResponseResult addchannel(@RequestBody WmChannel wmChannel){
        return channelService.add(wmChannel);
    }
    @PostMapping("/list")
    public ResponseResult getlist(@RequestBody ChannelDto ChannelDto){
        return channelService.getlist(ChannelDto);
    }
    @GetMapping("del/{id}")
    public ResponseResult delete(@PathVariable Integer id){
        return channelService.delete(id);
    }
    @PostMapping("/update")
    public ResponseResult updatechannel(@RequestBody WmChannel wmChannel){
        return channelService.updatechannel(wmChannel);
    }
}
